package com.mxf.code.state_factory2;

import org.springframework.stereotype.Component;

/**
 * 工厂类管理状态
 *
 * @author 28382
 */
@Component
public class StateFactory {
    public State getState(String stateType) {
        if (stateType == null) {
            return null;
        }
        if (stateType.equalsIgnoreCase("START")) {
            return new StartState();
        } else if (stateType.equalsIgnoreCase("STOP")) {
            return new StopState();
        }
        return null;
    }
}
